<%--
 *  File:    CitySelect.jsp
 *  @Author: AndyYang
 *  Date:    Thursday, February 13, 2003

 *  Copyright (C) 2002 - 2003 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  Category cat = Category.getInstance("jsp.CitySelect");
  String strModuleName = "OGM";
  String strTableName = "ovcity";
  String parentcitycode = (String)request.getParameter("parentcitycode");
  String grade = (String)request.getParameter("grade");
  String flag = (String)request.getParameter("flag");
%>

<%@include file="/inc/PageDefault.inc"%>

<html>
<head>
<title>cityselect</title>
<PageFlow:CheckPageFlow pageName="cityselect"/>
<script language="JavaScript" src="../../js/ScriptLib.js"></script>
<%@include file="/inc/SumDiv.inc"%>
<script language="JavaScript" src="../../js/SummaryDivision.js"></script>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{ 
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "CitySelect.jsp?<%= OvalTools.randomURL() %>&grade=<%=grade%>&parentcitycode=<%=parentcitycode%>&flag=<%=flag%>";
  isRunning = true;
  editform.target = "_self";
  editform.submit();  
}
function setParentValue()
{
  opener.page_setCity(cform.citycode.value,cform.cityname.value,cform.cityid.value,'<%=flag%>');
  window.close(); 
}
function clickThisCity(code, name,id)
{
  cform.citycode.value = code;
  cform.cityname.value = name;
  cform.cityid.value = id;
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="cform" method="post" action="../../Dispatcher">
    <input type="hidden" name="pagename" value="cityselect">
    <input type="hidden" name="actionname">
    <oval:hidden property="countrycode" />
    <oval:hidden property="regioncode" />
    <oval:hidden property="owncitycode" />
    
<table width="100%" cellspacing="0" cellpadding="0" height="100%">
    <tr> 
      <td valign="top"> 
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr> 
            <td class="summary_top"></td>
          </tr>
        </table>
        <table width="100%" cellspacing="0" cellpadding="0">

		<%@include file="/inc/SummarySearch.inc" %>

          <tr> 
            <td height="5" colspan="2" class="summary_top"></td>
          </tr>
        </table>
        
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
          <tr class="deepblue-left" > 
            <td width="5%" class="title_center">&nbsp;</td>
            <td class="title_center"><%= label.getLabelName("L_CityCode")%></td>
            <td class="title_center"><%= label.getLabelName("L_CityName1")%></td>
          </tr>
          <%
            Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
            if(totalsummary == null)
            {
              totalsummary = new Vector();
            }               		  
            int i=0;
            String strClassType="td-listrom";
            String strIsChecked = "";
            Integer defaultCityId = null;
            String defaultCityCode = "";
            String defaultCityName = "";        		  
          %>
          	    
          <logic:iterate id="detailinfo" collection="<%= totalsummary %>">
          <%
            //i=orderId.intValue();
            HashMap currentLine = (HashMap)pageContext.getAttribute("detailinfo");
            
            if(i==0)
	    {
	      strIsChecked = "Checked";
	      defaultCityId = (Integer)(currentLine.get("cityid"));
	      defaultCityCode = (String)(currentLine.get("citycode"));
              defaultCityName = (String)(currentLine.get("cityname"));
	    }else
	    {
	      strIsChecked = "";
	    }
	    if(i%2==0)
	    {
	      strClassType = "none";
	    }else
	    {
	      strClassType="td-listrom";
	    }
	    i++;
          %>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="javascript:radiotrue('cbox<%=JspHelper.filterNull( i )%>');clickThisCity('<%=JspHelper.filterNull( currentLine.get("citycode"))%>','<%=JspHelper.filterNull( currentLine.get("cityname"))%>','<%=JspHelper.filterNull( currentLine.get("cityid"))%>');" class="<%=JspHelper.filterNull( strClassType )%>">
            <td> 
              <input id="cbox<%=JspHelper.filterNull( i )%>" type="radio" name="radiobutton" value="<%=JspHelper.filterNull( currentLine.get("cityid"))%>" class="normalradio" <%=JspHelper.filterNull( strIsChecked )%>>
            </td>
            <td><oval:write name="detailinfo" property="citycode" /></td>
            <td><oval:write name="detailinfo" property="cityname" /></td>
          </tr>
          </logic:iterate>       	  
	  <%@include file="/inc/SummaryAction.inc" %>
	  
	  <input type="hidden" name="citycode" value="<%=JspHelper.filterNull( defaultCityCode )%>">
          <input type="hidden" name="cityname" value="<%=JspHelper.filterNull( defaultCityName )%>">
          <input type="hidden" name="cityid" value="<%=JspHelper.filterNull( defaultCityId )%>">
      </table>
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr> 
            <td class="summary_top"></td>
          </tr>
          <tr>             
            <td class="td_center"><a onclick="setParentValue();"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a></td>
          </tr>
        </table>
      </td>
    </tr>
</table>
</form>
</body>
</html>


